<?php

class CGamefbteam extends Zend_Db_Table
{

    protected $_name;

    protected $_primary;

    public function _setup()
    {

        $this->_name=R_PRE."game_fb_teams";

        $this->_primary="id";

        parent::_setup();

    }

    public function createFbteam($data)
    {

        $this->insert($data);
        
        return true;

    }
    
    public function editFbteam($itemid,$data)
        {
		$db=$this->getAdapter();

		$where = $db->quoteInto('itemid = ?', $itemid);

		$rows_affected=$db->update($this->_name,$data,$where);

		if($rows_affected!=1){

			return false;

		}else{

			return true;

		}
        }

    public function getteams(){
		
        $db=$this->getAdapter();

        $select = $db->select();

        $select->from($this->_name,'*');

        $select->order("add_time DESC");

        return $db->fetchAll($select);
        
    }
    
    public function delFbteam($itemidArray){

            $db=$this->getAdapter();

            $itemidString=join(',',$itemidArray);

            $result=$db->query("DELETE FROM $this->_name WHERE itemid IN ($itemidString)");

            return $result;

    }
}